package org.etlt.load;

import org.etlt.SettingCheck;

import java.util.Objects;

public class DmlEntitySetting implements SettingCheck{
    private final String name;

    private String expression;

    private Object value;

    public DmlEntitySetting(String name) {
        assertName("name", name);
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getExpression() {
        return expression;
    }

    public void setExpression(String expression) {
        this.expression = expression;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DmlEntitySetting that = (DmlEntitySetting) o;
        return Objects.equals(getName(), that.getName());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getName());
    }

    @Override
    public void check() {
        assertNotNull("expression", this.expression);
    }
}
